<script>
    $.ajax({
        url: 'http://example.com/api',
        type: 'GET',
        xhrFields: {
            withCredentials: true
        },
        success: function (data, status, xhr) {
            var cookies = xhr.getResponseHeader('Set-Cookie'); // 获取响应头中的cookie
            console.log(cookies);
        }
    });

    success: function (res, xhr) {
        console.log(res);
        var cookies = xhr.getResponseHeader('Set-Cookie'); // 获取响应头中的cookie
        console.log(cookies);
        //  SetCookie("token", res.data.token);
        //  SetCookie("userinfo", res.data);
    },
</script>